package com.exception.demo01;

public class Test2 {
    public static void main(String[] args) {
        int a = 1;
        int b = 0;

        // Ctrl + Alt + T
        try {
            if(b == 0){   //throw throws
                throw new ArithmeticException();    //主动抛出异常,一般在方法中使用。方法上抛出异常
            }
            System.out.println(a / b);
        } catch (Exception e) {
            System.exit(1);
            e.printStackTrace();    //打印错误的栈信息
        } finally {
        }
    }
}
